package _8

/*
时间复杂度：O()
空间复杂度：O()
TODO:
*/

func findAllRecipes(recipes []string, ingredients [][]string, supplies []string) []string {
	hash := make(map[string]bool)
	for _, s := range supplies {
		hash[s] = true
	}

	result := make([]string, 0)
	for i, s := range recipes {
		flag := true
		for _, si := range ingredients[i] {
			if _, ok := hash[si]; !ok {
				flag = false
				break
			}
		}
		if flag {
			result = append(result, s)
			hash[s] = true
		}
	}
	return result
}
